import React, { useState } from 'react';
import { Modal, Button, Input, Form, Radio } from 'antd';

function OrderAdd() {
    const [isModalVisible, setIsModalVisible] = useState(false);

    const showModal = () => {
        setIsModalVisible(true);
    };

    const handleOk = () => {
        setIsModalVisible(false);
    };

    const handleCancel = () => {
        setIsModalVisible(false);
    };

    // 单选框
    const [value, setValue] = React.useState(1);

    const onChange = e => {
        console.log('radio checked', e.target.value);
        setValue(e.target.value);
    };
    return (
        <div>
            <Button type="primary" onClick={showModal}>
                添加
            </Button>
            <Modal
                title="添加"
                visible={isModalVisible}
                onCancel={handleCancel}
                footer={[
                    <Button onClick={handleOk}>确认</Button>,
                    <Button onClick={handleCancel}>取消</Button>
                ]}>
                <p>取消原因：</p>
                <p>
                    <Form.Item >
                        <Input placeholder="请输入取消原因" />
                    </Form.Item>
                </p>
                <p>状态：</p>
                <p>
                    <Form.Item>
                        <Radio.Group onChange={onChange} value={value}>
                            <Radio value={1}>启用</Radio>
                            <Radio value={2}>禁用</Radio>
                        </Radio.Group>
                    </Form.Item>
                </p>
            </Modal>
        </div>
    )
}
export default OrderAdd;